package com.twu.biblioteca;

import com.twu.biblioteca.menu.Menu;
import com.twu.biblioteca.menu.MenuOption;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BibliotecaApp {

    public static void main(String[] args) throws IOException {
        Menu menu = new Menu();
        menu.display();

        while (true) {
            try {
                MenuOption option = menu.handleInput(Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine())).getOption();
                menu.execute(option);
                menu.display();
            }catch (Exception e){
                System.out.println( e.getMessage());
            }
        }

    }
}